#include "EpilLocalFunctionStatementInterpreter.h"
#include "EpilInterpreterException.h"
#include "EpilInterpreter.h"
#include "EpilFunctionBodyExpressionInterpreter.h"


EpilLocalFunctionStatementInterpreter::EpilLocalFunctionStatementInterpreter( EpilInterpreter * interpreter )
: EpilInterpreterBase( interpreter )
{
}


void EpilLocalFunctionStatementInterpreter::Run( const EpilLocalFunctionStatementCode * code )
{
	EpilFunctionBodyExpressionInterpreter ebei( this->GetInterpreter() );
	ebei.Run( code->GetBody() );
	EpilScriptFunctionObject * funcObj = ebei.GetFunction();

	EpilScope * curScope = this->GetInterpreter()->GetCurrentScope();
	curScope->SetLocal( code->GetName(), funcObj );
}